//SPDX-FileCopyrightText: Copyright 2022-2024 深圳市同心圆网络有限公司
//SPDX-License-Identifier: GPL-3.0-only

package metric_serv

import "github.com/prometheus/client_golang/prometheus"

var (
	grpcCount = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "grpc_count",
			Help: "number of grpc call",
		},
		[]string{"name", "status"},
	)
	grpcTime = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "grpc_time",
			Help:    "time of grpc call",
			Buckets: []float64{100.0, 200.0, 500.0, 1000.0, 2000.0, 5000.0, 10000.0},
		},
		[]string{"name", "status"},
	)
	HttpCount = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "http_count",
			Help: "number of http call",
		},
		[]string{"name", "code"},
	)
)

func init() {
	prometheus.MustRegister(grpcCount)
	prometheus.MustRegister(grpcTime)
	prometheus.MustRegister(HttpCount)
}
